package vn.edu.saigontech.ncms.model.depr;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.OptimisticLockType;

import vn.edu.saigontech.ncms.model.BaseEntity;
import vn.edu.saigontech.ncms.model.info.OfferingMember;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.ALL)
@Table(name = "ncms_second_final_test")
@MappedSuperclass
@SuppressWarnings("serial")
public class SecondFinalTestDepr extends BaseEntity {
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "offering_member_id")
	private OfferingMember offeringMember;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "second_spoken_date")
	private Date secondSpokenDate;

	@Temporal(TemporalType.DATE)
	@Column(name = "second_written_date")
	private Date secondWrittenDate;

	@Column(name = "listening")
	private Double listening;

	@Column(name = "grammar")
	private Double grammar;

	@Column(name = "speaking")
	private Double speaking;

	@Column(name = "reading")
	private Double reading;

	@Column(name = "writing")
	private Double writing;
	
	@Column(name = "comment", length = 4000)
	private String comment;

	// to check whether all grade has been input
	public boolean isAllGradeInput() {
		boolean ret = true;
		if (listening == null || grammar == null || speaking == null
				|| reading == null || writing == null) {
			ret = false;
		}
		return ret;
	}
	
	public OfferingMember getOfferingMember() {
		return offeringMember;
	}

	public void setOfferingMember(OfferingMember offeringMember) {
		this.offeringMember = offeringMember;
	}

	public Double getListening() {
		return listening;
	}

	public void setListening(Double listening) {
		this.listening = listening;
	}

	public Double getGrammar() {
		return grammar;
	}

	public void setGrammar(Double grammar) {
		this.grammar = grammar;
	}

	public Double getSpeaking() {
		return speaking;
	}

	public void setSpeaking(Double speaking) {
		this.speaking = speaking;
	}

	public Double getReading() {
		return reading;
	}

	public void setReading(Double reading) {
		this.reading = reading;
	}

	public Double getWriting() {
		return writing;
	}

	public void setWriting(Double writing) {
		this.writing = writing;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Date getSecondSpokenDate() {
		return secondSpokenDate;
	}

	public void setSecondSpokenDate(Date secondSpokenDate) {
		this.secondSpokenDate = secondSpokenDate;
	}

	public Date getSecondWrittenDate() {
		return secondWrittenDate;
	}

	public void setSecondWrittenDate(Date secondWrittenDate) {
		this.secondWrittenDate = secondWrittenDate;
	}
}